<template>
	<view class="main">
		<v-nav class="naver" :mlist="subject_list" @ck="ckSubject"></v-nav>
		<view class="content-main">
			<v-filter-bar ref="filterbar"></v-filter-bar>
			<view class="lesson-warp" @click="hideAll" v-for="(card, idx) in subject_card_list" :key="idx">
				<view class="item"><v-competitive-summary mclass="lesson-card" :card="card"></v-competitive-summary></view>
			</view>
		</view>
	</view>
</template>

<script>
	import competitiveSummary from './components/competitive-summary';
	import filters from './components/filter-bar.vue';
	import nav from './components/nav';
	export default {
		data() {
			return {
				subject_list: ['语文','数学','英语','物理','化学','生物','政治','地理'],
				
				levelSeleting: false,
				
				cur_subject: 0,
				
				subject_card_list: []
			}
		},
		onLoad() {
			var _vm = this;
			uni.showLoading({title: '加载中'})
			mock.post('/lesson/getfreelessons',{lesson: 'free'}).then(res=>{
				_vm.subject_card_list = res.data;
				uni.hideLoading()
			})
		},
		methods: {
			ckSubject (idx) {
				this.cur_subject = idx
			},
			bindChange(evt){
				console.log(evt)
			},
			hideAll(){
				this.$refs.filterbar.hideAll()
			}
		},
		components: {
			vNav: nav,
			vCompetitiveSummary: competitiveSummary,
			vFilterBar: filters
		},
	}
</script>

<style>
page{background: #F7F7F7;}

.lesson-warp{padding: 0 40upx;}
.lesson-warp .item{margin-bottom: 20upx; width:100%;}
.item .lesson-card{background: #FFF !important; border-radius: 20upx;}

.content-main{position: relative;}

</style>
